
foreach(varname IN ITEMS
  WITH_CONFIG_FILE
  SCRIPT_MODE
  TEST_FUNCTION
  TEST_GENERATOR
  )
  if(NOT DEFINED ${varname})
    message(FATAL_ERROR "Make sure variable ${varname} is defined")
  endif()
endforeach()

set(APP4CONFIGURELAUNCHERTEST_ROOT_BINARY_DIR "@APP4CONFIGURELAUNCHERTEST_ROOT_BINARY_DIR@")

set(app4configurelaunchertest_source_dir "@APP4CONFIGURELAUNCHERTEST_SOURCE_DIR@")
if(WITH_CONFIG_FILE)
  set(dirname "App4ConfigureLauncherTestWithConfigFile${SCRIPT_MODE}${TEST_FUNCTION}${TEST_GENERATOR}")
else()
  set(dirname "App4ConfigureLauncherTest${SCRIPT_MODE}${TEST_FUNCTION}${TEST_GENERATOR}")
endif()
string(SHA256 dirname_hashed ${dirname})
string(SUBSTRING ${dirname_hashed} 0 7 dirname_hashed)
file(WRITE "${APP4CONFIGURELAUNCHERTEST_ROOT_BINARY_DIR}/${dirname_hashed}-build - ${dirname}.txt" "")
set(app4configurelaunchertest_binary_dir "${APP4CONFIGURELAUNCHERTEST_ROOT_BINARY_DIR}/${dirname_hashed}-build")
set(app4configurelaunchertest_build_type "@APP4CONFIGURELAUNCHERTEST_BUILD_TYPE@")

if(TEST_GENERATOR STREQUAL "NinjaGenerator")
  set(app4configurelaunchertest_cmake_generator "Ninja")
else()
  set(app4configurelaunchertest_cmake_generator "@APP4CONFIGURELAUNCHERTEST_CMAKE_GENERATOR@")
endif()

set(ctkapplauncher_dir "@LAUNCHER_DIR@")

# --------------------------------------------------------------------------
# Sanity checks

if(NOT EXISTS ${app4configurelaunchertest_source_dir})
  message(FATAL_ERROR "Make sure variable APP4CONFIGURELAUNCHERTEST_SOURCE_DIR is set to a valid directory. "
                      "APP4CONFIGURELAUNCHERTEST_SOURCE_DIR [${app4configurelaunchertest_source_dir}]")
endif()
